from likeshop_api_project.api.login_api import login_model
from likeshop_api_project.base.mybase import Tools


# 删除购物车
class del_cart_model(Tools):
    path = '/api/cart/del'

    def del_cart_action(self, cart_id, hd):
        del_cart_data = {
            "cart_id": cart_id,
        }
        del_cart = self.huihua.post(url=self.hosturl+self.path, data=del_cart_data, headers=hd)
        return del_cart.json()



if __name__ == '__main__':
    import requests

    s = requests.session()
    reg = login_model(huihua=s)
    msg = reg.login_action(account="13356786546", password="rr98765", client=2)
    # print(msg)
    get_token = msg["data"]["token"]
    # print(get_token)
    hd = {"token": get_token}

    del_cart = del_cart_model(huihua=s)
    msg = del_cart.del_cart_action(cart_id=270, hd=hd)
    print(msg)

    # shop_cart = shop_cart_model(huihua=s)
    # msg = shop_cart.shop_cart_action(hd=hd)
    # print(msg)
    # get_cardid = msg["data"]["lists"][0]["cart_id"]
    # print(get_cardid)